package com.axjy.web;

import com.axjy.pojo.Menu;
import com.axjy.pojo.User;
import com.axjy.service.PermissionService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;

/**
 * Created by asus on 2018/1/15.
 */
@Controller
public class IndexHandler{

    @Resource
    private PermissionService permissionService;

    @RequestMapping("/index")
    public String index(HttpSession session, Model model){
        User loginUser= (User) session.getAttribute("loginUser");
        Map<Menu,List<Menu>> map=permissionService.createMenus(loginUser.getId());
        model.addAttribute("menus",map);
        return "index";
    }

    @RequestMapping("/rwshow")
    public String xjrw(){
        return "config/xjrwzdfp";
    }

    @RequestMapping("/show1")
    public String show(){
        return "config/show";
    }

    @RequestMapping("/qxdjshow")
    public String qxdjshow(){
        return "config/qxdjshow";
    }

    @RequestMapping("/zxhzshow")
    public String zxshou(){return "config/xjzxhz";}

    @RequestMapping("/qxcx")
    public String qxshow(){
        return "config/qxcx";
    }

}
